package com.maize.uwwireless;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.util.Linkify;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;

public class Help extends Activity 
{
	public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.help);
        
        // Set share button action
        ImageButton shareButton = (ImageButton) this.findViewById(R.id.share_button);
        shareButton.setOnClickListener(new OnClickListener()
        {
			public void onClick(View v) 
			{
				Intent share = new Intent(Help.this, Share.class);
            	startActivity(share);
			}        	
        });
        
        // Set email button action
        ImageButton emailButton = (ImageButton) this.findViewById(R.id.email_button);
        emailButton.setOnClickListener(new OnClickListener()
        {
			public void onClick(View v) 
			{
				Intent sendIntent = new Intent(Intent.ACTION_SEND);
		    	String[] recipient={"maize.hkg@gmail.com"};
		    	sendIntent.putExtra(Intent.EXTRA_EMAIL , recipient);
		    	sendIntent.putExtra(Intent.EXTRA_SUBJECT, "[Waterloo for Android] ");
		    	sendIntent.setType("message/rfc822");
		    	startActivity(Intent.createChooser(sendIntent, "Title"));
			}        	
        });
        
        // Linkify the web url, http://code.google.com/p/waterloo-for-android/
        TextView source = (TextView) this.findViewById(R.id.sourcecode);
        Linkify.addLinks(source, Linkify.WEB_URLS); 
    }
}
